package com.qipay.mapper;

import com.qipay.baas.model.Configuration;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

/**
 * Creator: Yao
 * Date:    2017/9/30
 * For:
 * Other:
 */
@Mapper
public interface ConfigurationMapper extends com.qipay.baas.mapper.ConfigurationMapper {

    @Select({
            "select * ",
            "from `configuration`",
    })
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT),
            @Result(column = "value", property = "value", jdbcType = JdbcType.VARCHAR),
            @Result(column = "info", property = "info", jdbcType = JdbcType.VARCHAR)
    })
    List<Configuration> selectAll();

    @Select({"select * from `configuration` where type= #{type}"})
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT),
            @Result(column = "value", property = "value", jdbcType = JdbcType.VARCHAR),
            @Result(column = "info", property = "info", jdbcType = JdbcType.VARCHAR)
    })
    Configuration selectByType(@Param("type") byte type);
}
